import instance from "@/utils/request";

export function getUsersRolesApi(params) {
    return instance({
        url: '/sys/role',
        params
    })
}
// 根据 id 更新角色信息
export function updateRoleByIdApi(data) {
    return instance({
        url: `/sys/role/${data.id}`,
        method: 'PUT',
        data
    })
}

// 根据 id 新增角色信息
export function addRoleByIdApi(data) {
    return instance({
        url: '/sys/role',
        method: 'POST',
        data
    })
}

// 根据 id 删除角色信息
export function delRoleByIdApi(id) {
    return instance({
        url: `/sys/role/${id}`,
        method: 'DELETE'
    })
}
export function getRoleDetailAPI(id) {
    return instance({
        url: `/sys/role/${id}`
    })
}

// 给角色分配权限
export function setRolePermissionApi(data) {
    return instance({
        url: '/sys/role/assignPrem',
        method: 'PUT',
        data
    })
}
